/*
PostgreSQL Backup
Database: postgres/tanpuhui
Backup Time: 2024-09-27 00:28:31
*/


-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."activity";

-- Creating table
CREATE TABLE "activity" (
                            "activity_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('activity'::text, 'activity_id'::text))::regclass),
                            "activity_name" varchar(255) COLLATE "pg_catalog"."default",
                            "img_path" varchar(255) COLLATE "pg_catalog"."default",
                            "video_path" varchar(255) COLLATE "pg_catalog"."default",
                            "activity_intro" varchar(255) COLLATE "pg_catalog"."default",
                            "activity_address" varchar(255) COLLATE "pg_catalog"."default",
                            "apply_start_time" timestamp(6),
                            "apply_end_time" timestamp(6),
                            "activity_start_time" timestamp(6),
                            "activity_end_time" timestamp(6),
                            "member_max" int4,
                            "member_min" int4,
                            "publisher" varchar(255) COLLATE "pg_catalog"."default",
                            "apply_members" int4,
                            "activity_co2" int4,
                            "status" int4,
                            "create_time" timestamp(6),
                            "update_time" timestamp(6),
                            "ext1" varchar(255) COLLATE "pg_catalog"."default",
                            "ext2" varchar(255) COLLATE "pg_catalog"."default",
                            "ext3" varchar(255) COLLATE "pg_catalog"."default",
                            "ext4" varchar(255) COLLATE "pg_catalog"."default",
                            "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "activity" OWNER TO "postgres";
ALTER TABLE "activity" ADD CONSTRAINT "activity_pkey" PRIMARY KEY ("activity_id");
ALTER TABLE "activity" ADD CONSTRAINT "unique_activity_id" UNIQUE ("activity_id");
COMMENT ON TABLE "activity" IS '活动表';
COMMENT ON COLUMN "activity"."activity_id" IS '活动编号';
COMMENT ON COLUMN "activity"."activity_name" IS '活动名称';
COMMENT ON COLUMN "activity"."img_path" IS '活动图片路径';
COMMENT ON COLUMN "activity"."video_path" IS '活动视频路径';
COMMENT ON COLUMN "activity"."activity_intro" IS '活动简介';
COMMENT ON COLUMN "activity"."activity_address" IS '活动地址';
COMMENT ON COLUMN "activity"."apply_start_time" IS '报名开始时间';
COMMENT ON COLUMN "activity"."apply_end_time" IS '报名结束时间';
COMMENT ON COLUMN "activity"."activity_start_time" IS '活动开始时间';
COMMENT ON COLUMN "activity"."activity_end_time" IS '活动结束时间';
COMMENT ON COLUMN "activity"."member_max" IS '最大人数';
COMMENT ON COLUMN "activity"."member_min" IS '最小人数';
COMMENT ON COLUMN "activity"."publisher" IS '发布者';
COMMENT ON COLUMN "activity"."apply_members" IS '已报名人数';
COMMENT ON COLUMN "activity"."activity_co2" IS '活动的减碳量';
COMMENT ON COLUMN "activity"."status" IS '状态（0-正常,1-暂停,2-删除)';
COMMENT ON COLUMN "activity"."create_time" IS '创建时间';
COMMENT ON COLUMN "activity"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."activity_logs";

-- Creating table
CREATE TABLE "activity_logs" (
                                 "participate_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('activity_logs'::text, 'participate_id'::text))::regclass),
                                 "activity_id" int4,
                                 "user_id" int4,
                                 "apply_time" timestamp(6),
                                 "participate_time" timestamp(6),
                                 "reduce_co2" float8,
                                 "earn_points" float8,
                                 "is_del" int4,
                                 "create_time" timestamp(6),
                                 "update_time" timestamp(6),
                                 "ext1" varchar(255) COLLATE "pg_catalog"."default",
                                 "ext2" varchar(255) COLLATE "pg_catalog"."default",
                                 "ext3" varchar(255) COLLATE "pg_catalog"."default",
                                 "ext4" varchar(255) COLLATE "pg_catalog"."default",
                                 "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "activity_logs" OWNER TO "postgres";
ALTER TABLE "activity_logs" ADD CONSTRAINT "activity_logs_pkey" PRIMARY KEY ("participate_id");
ALTER TABLE "activity_logs" ADD CONSTRAINT "unique_participate_id" UNIQUE ("participate_id");
COMMENT ON TABLE "activity_logs" IS '活动参与记录表';
COMMENT ON COLUMN "activity_logs"."participate_id" IS '活动参与编号';
COMMENT ON COLUMN "activity_logs"."activity_id" IS '活动编号';
COMMENT ON COLUMN "activity_logs"."user_id" IS '用户编号';
COMMENT ON COLUMN "activity_logs"."apply_time" IS '报名时间';
COMMENT ON COLUMN "activity_logs"."participate_time" IS '参与时间';
COMMENT ON COLUMN "activity_logs"."reduce_co2" IS '减碳量';
COMMENT ON COLUMN "activity_logs"."earn_points" IS '获得积分';
COMMENT ON COLUMN "activity_logs"."is_del" IS '是否删除';
COMMENT ON COLUMN "activity_logs"."create_time" IS '创建时间';
COMMENT ON COLUMN "activity_logs"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."address";

-- Creating table
CREATE TABLE "address" (
                           "address_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('address'::text, 'address_id'::text))::regclass),
                           "consignee_name" varchar(255) COLLATE "pg_catalog"."default",
                           "consignee_phone" int8,
                           "province" varchar(255) COLLATE "pg_catalog"."default",
                           "city" varchar(255) COLLATE "pg_catalog"."default",
                           "area" varchar(255) COLLATE "pg_catalog"."default",
                           "detail_address" varchar(255) COLLATE "pg_catalog"."default",
                           "is_default" int4,
                           "is_del" int4,
                           "user_id" int4,
                           "create_time" timestamp(6),
                           "update_time" timestamp(6),
                           "ext1" varchar(255) COLLATE "pg_catalog"."default",
                           "ext2" varchar(255) COLLATE "pg_catalog"."default",
                           "ext3" varchar(255) COLLATE "pg_catalog"."default",
                           "ext4" varchar(255) COLLATE "pg_catalog"."default",
                           "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "address" OWNER TO "postgres";
ALTER TABLE "address" ADD CONSTRAINT "address_pkey" PRIMARY KEY ("address_id");
ALTER TABLE "address" ADD CONSTRAINT "unique_address_id" UNIQUE ("address_id");
COMMENT ON TABLE "address" IS '地址信息表';
COMMENT ON COLUMN "address"."address_id" IS '地址编号';
COMMENT ON COLUMN "address"."consignee_name" IS '收件人姓名';
COMMENT ON COLUMN "address"."consignee_phone" IS '收件人电话';
COMMENT ON COLUMN "address"."province" IS '省份';
COMMENT ON COLUMN "address"."city" IS '城市';
COMMENT ON COLUMN "address"."area" IS '区县';
COMMENT ON COLUMN "address"."detail_address" IS '详细地址';
COMMENT ON COLUMN "address"."is_default" IS '是否默认地址';
COMMENT ON COLUMN "address"."is_del" IS '是否删除';
COMMENT ON COLUMN "address"."user_id" IS '用户编号';
COMMENT ON COLUMN "address"."create_time" IS '创建时间';
COMMENT ON COLUMN "address"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."behavior";

-- Creating table
CREATE TABLE "behavior" (
                            "behavior_code" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('behavior'::text, 'behavior_code'::text))::regclass),
                            "behavior_name" varchar(255) COLLATE "pg_catalog"."default",
                            "type_unit_code" int4,
                            "type_unit_name" varchar(255) COLLATE "pg_catalog"."default",
                            "co2_coefficine" float8,
                            "is_del" int4,
                            "create_time" timestamp(6),
                            "update_time" timestamp(6),
                            "ext1" varchar(255) COLLATE "pg_catalog"."default",
                            "ext2" varchar(255) COLLATE "pg_catalog"."default",
                            "ext3" varchar(255) COLLATE "pg_catalog"."default",
                            "ext4" varchar(255) COLLATE "pg_catalog"."default",
                            "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "behavior" OWNER TO "postgres";
ALTER TABLE "behavior" ADD CONSTRAINT "behavior_pkey1" PRIMARY KEY ("behavior_code");
ALTER TABLE "behavior" ADD CONSTRAINT "unique_behavior_code" UNIQUE ("behavior_code");
COMMENT ON TABLE "behavior" IS '低碳行为表';
COMMENT ON COLUMN "behavior"."behavior_code" IS '行为编号';
COMMENT ON COLUMN "behavior"."behavior_name" IS '行为名称';
COMMENT ON COLUMN "behavior"."type_unit_code" IS '类型单位编号';
COMMENT ON COLUMN "behavior"."type_unit_name" IS '类型单位名称';
COMMENT ON COLUMN "behavior"."co2_coefficine" IS '减碳量系数';
COMMENT ON COLUMN "behavior"."is_del" IS '是否删除';
COMMENT ON COLUMN "behavior"."create_time" IS '创建时间';
COMMENT ON COLUMN "behavior"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."behavior_recode";

-- Creating table
CREATE TABLE "behavior_recode" (
                                   "behavior_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('behavior_recode'::text, 'behavior_id'::text))::regclass),
                                   "behavior_type" varchar(255) COLLATE "pg_catalog"."default",
                                   "behavior_code" int4,
                                   "reduce_co2" float8,
                                   "earn_points" int4,
                                   "user_id" int4,
                                   "record_date" timestamp(6),
                                   "is_del" int4,
                                   "create_time" timestamp(6),
                                   "update_time" timestamp(6),
                                   "ext1" varchar(255) COLLATE "pg_catalog"."default",
                                   "ext2" varchar(255) COLLATE "pg_catalog"."default",
                                   "ext3" varchar(255) COLLATE "pg_catalog"."default",
                                   "ext4" varchar(255) COLLATE "pg_catalog"."default",
                                   "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "behavior_recode" OWNER TO "postgres";
ALTER TABLE "behavior_recode" ADD CONSTRAINT "behavior_pkey" PRIMARY KEY ("behavior_id");
ALTER TABLE "behavior_recode" ADD CONSTRAINT "unique_behavior_id" UNIQUE ("behavior_id");
COMMENT ON TABLE "behavior_recode" IS '低碳行为记录表';
COMMENT ON COLUMN "behavior_recode"."behavior_id" IS '行为记录编号';
COMMENT ON COLUMN "behavior_recode"."behavior_type" IS '行为类型';
COMMENT ON COLUMN "behavior_recode"."behavior_code" IS '行为编号';
COMMENT ON COLUMN "behavior_recode"."reduce_co2" IS '减碳量';
COMMENT ON COLUMN "behavior_recode"."earn_points" IS '获得积分';
COMMENT ON COLUMN "behavior_recode"."user_id" IS '用户编号';
COMMENT ON COLUMN "behavior_recode"."record_date" IS '记录日期';
COMMENT ON COLUMN "behavior_recode"."is_del" IS '是否删除';
COMMENT ON COLUMN "behavior_recode"."create_time" IS '创建时间';
COMMENT ON COLUMN "behavior_recode"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."cart";

-- Creating table
CREATE TABLE "cart" (
                        "cart_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('cart'::text, 'cart_id'::text))::regclass),
                        "user_id" int4,
                        "goods_id" int4,
                        "goods_counts" int4,
                        "create_time" timestamp(6),
                        "update_time" timestamp(6),
                        "ext1" varchar(255) COLLATE "pg_catalog"."default",
                        "ext2" varchar(255) COLLATE "pg_catalog"."default",
                        "ext3" varchar(255) COLLATE "pg_catalog"."default",
                        "ext4" varchar(255) COLLATE "pg_catalog"."default",
                        "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "cart" OWNER TO "postgres";
ALTER TABLE "cart" ADD CONSTRAINT "cart_pkey" PRIMARY KEY ("cart_id");
ALTER TABLE "cart" ADD CONSTRAINT "unique_cart_id" UNIQUE ("cart_id");
COMMENT ON TABLE "cart" IS '购物车表';
COMMENT ON COLUMN "cart"."cart_id" IS '购物车编号';
COMMENT ON COLUMN "cart"."user_id" IS '用户编号';
COMMENT ON COLUMN "cart"."goods_id" IS '商品编号';
COMMENT ON COLUMN "cart"."goods_counts" IS '商品数量';
COMMENT ON COLUMN "cart"."create_time" IS '创建时间';
COMMENT ON COLUMN "cart"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."goods";

-- Creating table
CREATE TABLE "goods" (
                         "goods_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('goods'::text, 'goods_id'::text))::regclass),
                         "goods_name" varchar(255) COLLATE "pg_catalog"."default",
                         "goods_intro" varchar(255) COLLATE "pg_catalog"."default",
                         "goods_image" varchar(255) COLLATE "pg_catalog"."default",
                         "goods_price" float8,
                         "goods_discount" float8,
                         "use_points" int4,
                         "shop_id" int4,
                         "sale_mode" varchar(255) COLLATE "pg_catalog"."default",
                         "relate_goods_id" int4,
                         "goods_type_id" int4,
                         "stander" varchar(255) COLLATE "pg_catalog"."default",
                         "state" int4,
                         "evaluate_id" int4,
                         "is_del" int4,
                         "create_time" timestamp(6),
                         "update_time" timestamp(6),
                         "ext1" varchar(255) COLLATE "pg_catalog"."default",
                         "ext2" varchar(255) COLLATE "pg_catalog"."default",
                         "ext3" varchar(255) COLLATE "pg_catalog"."default",
                         "ext4" varchar(255) COLLATE "pg_catalog"."default",
                         "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "goods" OWNER TO "postgres";
ALTER TABLE "goods" ADD CONSTRAINT "goods_pkey" PRIMARY KEY ("goods_id");
ALTER TABLE "goods" ADD CONSTRAINT "unique_goods_id" UNIQUE ("goods_id");
COMMENT ON TABLE "goods" IS '商品表';
COMMENT ON COLUMN "goods"."goods_id" IS '商品编号';
COMMENT ON COLUMN "goods"."goods_name" IS '商品名称';
COMMENT ON COLUMN "goods"."goods_intro" IS '商品简介';
COMMENT ON COLUMN "goods"."goods_image" IS '商品图片';
COMMENT ON COLUMN "goods"."goods_price" IS '商品价格';
COMMENT ON COLUMN "goods"."goods_discount" IS '商品折扣系数';
COMMENT ON COLUMN "goods"."use_points" IS '使用积分量';
COMMENT ON COLUMN "goods"."shop_id" IS '商铺编号';
COMMENT ON COLUMN "goods"."sale_mode" IS '销售方式(售卖品/赠送品)';
COMMENT ON COLUMN "goods"."relate_goods_id" IS '关联商品编号';
COMMENT ON COLUMN "goods"."goods_type_id" IS '商品类型编号';
COMMENT ON COLUMN "goods"."stander" IS '商品规格';
COMMENT ON COLUMN "goods"."state" IS '商品状态(0-正常,1-下架)';
COMMENT ON COLUMN "goods"."evaluate_id" IS '评价编号';
COMMENT ON COLUMN "goods"."is_del" IS '是否删除';
COMMENT ON COLUMN "goods"."create_time" IS '创建时间';
COMMENT ON COLUMN "goods"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."goods_evaluate";

-- Creating table
CREATE TABLE "goods_evaluate" (
                                  "evaluate_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('goods_evaluate'::text, 'evaluate_id'::text))::regclass),
                                  "order_id" int4,
                                  "goods_id" int4,
                                  "evaluate_type" varchar(255) COLLATE "pg_catalog"."default",
                                  "evaluate_content" varchar(255) COLLATE "pg_catalog"."default",
                                  "evaluate_image" varchar(255) COLLATE "pg_catalog"."default",
                                  "evaluate_video" varchar(255) COLLATE "pg_catalog"."default",
                                  "evaluate_time" timestamp(6),
                                  "is_del" int4,
                                  "create_time" timestamp(6),
                                  "update_time" timestamp(6),
                                  "ext1" varchar(255) COLLATE "pg_catalog"."default",
                                  "ext2" varchar(255) COLLATE "pg_catalog"."default",
                                  "ext3" varchar(255) COLLATE "pg_catalog"."default",
                                  "ext4" varchar(255) COLLATE "pg_catalog"."default",
                                  "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "goods_evaluate" OWNER TO "postgres";
ALTER TABLE "goods_evaluate" ADD CONSTRAINT "goods_evaluate_pkey" PRIMARY KEY ("evaluate_id");
ALTER TABLE "goods_evaluate" ADD CONSTRAINT "unique_evaluate_id" UNIQUE ("evaluate_id");
COMMENT ON TABLE "goods_evaluate" IS '商品评价表';
COMMENT ON COLUMN "goods_evaluate"."evaluate_id" IS '评价编号';
COMMENT ON COLUMN "goods_evaluate"."order_id" IS '订单编号';
COMMENT ON COLUMN "goods_evaluate"."goods_id" IS '商品编号';
COMMENT ON COLUMN "goods_evaluate"."evaluate_type" IS '评价类型(好评/中评/差评)';
COMMENT ON COLUMN "goods_evaluate"."evaluate_content" IS '评价内容';
COMMENT ON COLUMN "goods_evaluate"."evaluate_image" IS '评价图片';
COMMENT ON COLUMN "goods_evaluate"."evaluate_video" IS '评价视频';
COMMENT ON COLUMN "goods_evaluate"."evaluate_time" IS '评价时间';
COMMENT ON COLUMN "goods_evaluate"."is_del" IS '是否删除';
COMMENT ON COLUMN "goods_evaluate"."create_time" IS '创建时间';
COMMENT ON COLUMN "goods_evaluate"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."order";

-- Creating table
CREATE TABLE "order" (
                         "order_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('order'::text, 'order_id'::text))::regclass),
                         "pay_state" int4,
                         "order_price" float8,
                         "order_deduct_point" int4,
                         "order_deduct_amount" float8,
                         "address_id" int4,
                         "pay_way" varchar(255) COLLATE "pg_catalog"."default",
                         "pay_type" varchar(255) COLLATE "pg_catalog"."default",
                         "user_id" int4,
                         "is_del" int4,
                         "create_time" timestamp(6),
                         "update_time" timestamp(6),
                         "ext1" varchar(255) COLLATE "pg_catalog"."default",
                         "ext2" varchar(255) COLLATE "pg_catalog"."default",
                         "ext3" varchar(255) COLLATE "pg_catalog"."default",
                         "ext4" varchar(255) COLLATE "pg_catalog"."default",
                         "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "order" OWNER TO "postgres";
ALTER TABLE "order" ADD CONSTRAINT "order_pkey" PRIMARY KEY ("order_id");
ALTER TABLE "order" ADD CONSTRAINT "unique_order_id" UNIQUE ("order_id");
COMMENT ON TABLE "order" IS '订单表';
COMMENT ON COLUMN "order"."order_id" IS '订单编号';
COMMENT ON COLUMN "order"."pay_state" IS '支付状态(0-已支付,1-未支付)';
COMMENT ON COLUMN "order"."order_price" IS '订单价格';
COMMENT ON COLUMN "order"."order_deduct_point" IS '订单抵扣积分';
COMMENT ON COLUMN "order"."order_deduct_amount" IS '订单抵扣金额';
COMMENT ON COLUMN "order"."address_id" IS '地址编号';
COMMENT ON COLUMN "order"."pay_way" IS '支付方式';
COMMENT ON COLUMN "order"."pay_type" IS '支付类型';
COMMENT ON COLUMN "order"."user_id" IS '用户编号';
COMMENT ON COLUMN "order"."is_del" IS '是否删除';
COMMENT ON COLUMN "order"."create_time" IS '创建时间';
COMMENT ON COLUMN "order"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."order_item";

-- Creating table
CREATE TABLE "order_item" (
                              "order_item_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('order_item'::text, 'order_item_id'::text))::regclass),
                              "order_id" int4,
                              "goods_id" int4,
                              "goods_name" varchar(255) COLLATE "pg_catalog"."default",
                              "goods_count" int4,
                              "evaluate_state" int4,
                              "goods_price" float8,
                              "transaction_price" float8,
                              "deduct_points" int4,
                              "deduct_amount" float8,
                              "fee_shipping" int4,
                              "trans_fee" int4,
                              "shipping_methods" varchar(255) COLLATE "pg_catalog"."default",
                              "arrival_time" timestamp(6),
                              "create_time" timestamp(6),
                              "update_time" timestamp(6),
                              "ext1" varchar(255) COLLATE "pg_catalog"."default",
                              "ext2" varchar(255) COLLATE "pg_catalog"."default",
                              "ext3" varchar(255) COLLATE "pg_catalog"."default",
                              "ext4" varchar(255) COLLATE "pg_catalog"."default",
                              "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "order_item" OWNER TO "postgres";
ALTER TABLE "order_item" ADD CONSTRAINT "order_item_pkey" PRIMARY KEY ("order_item_id");
ALTER TABLE "order_item" ADD CONSTRAINT "unique_order_item_id" UNIQUE ("order_item_id");
COMMENT ON TABLE "order_item" IS '订单项表';
COMMENT ON COLUMN "order_item"."order_item_id" IS '订单项编号';
COMMENT ON COLUMN "order_item"."order_id" IS '订单编号';
COMMENT ON COLUMN "order_item"."goods_id" IS '商品编号';
COMMENT ON COLUMN "order_item"."goods_name" IS '商品名称';
COMMENT ON COLUMN "order_item"."goods_count" IS '商品数量';
COMMENT ON COLUMN "order_item"."evaluate_state" IS '评价状态(0-已评价,1-未评价)';
COMMENT ON COLUMN "order_item"."goods_price" IS '商品价格';
COMMENT ON COLUMN "order_item"."transaction_price" IS '交易价格';
COMMENT ON COLUMN "order_item"."deduct_points" IS '抵扣积分';
COMMENT ON COLUMN "order_item"."deduct_amount" IS '抵扣金额';
COMMENT ON COLUMN "order_item"."fee_shipping" IS '运费';
COMMENT ON COLUMN "order_item"."trans_fee" IS '交易手续费';
COMMENT ON COLUMN "order_item"."shipping_methods" IS '配送方式';
COMMENT ON COLUMN "order_item"."arrival_time" IS '到货时间';
COMMENT ON COLUMN "order_item"."create_time" IS '创建时间';
COMMENT ON COLUMN "order_item"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."shop";

-- Creating table
CREATE TABLE "shop" (
                        "shop_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('shop'::text, 'shop_id'::text))::regclass),
                        "shop_name" varchar(255) COLLATE "pg_catalog"."default",
                        "shop_intro" varchar(255) COLLATE "pg_catalog"."default",
                        "shop_rating" varchar(255) COLLATE "pg_catalog"."default",
                        "shop_address" varchar(255) COLLATE "pg_catalog"."default",
                        "contact" varchar(255) COLLATE "pg_catalog"."default",
                        "contact_phone" int8,
                        "email" varchar(255) COLLATE "pg_catalog"."default",
                        "contact_address" varchar(255) COLLATE "pg_catalog"."default",
                        "is_del" int4,
                        "create_time" timestamp(6),
                        "update_time" timestamp(6),
                        "ext1" varchar(255) COLLATE "pg_catalog"."default",
                        "ext2" varchar(255) COLLATE "pg_catalog"."default",
                        "ext3" varchar(255) COLLATE "pg_catalog"."default",
                        "ext4" varchar(255) COLLATE "pg_catalog"."default",
                        "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "shop" OWNER TO "postgres";
ALTER TABLE "shop" ADD CONSTRAINT "shop_pkey" PRIMARY KEY ("shop_id");
ALTER TABLE "shop" ADD CONSTRAINT "unique_shop_id" UNIQUE ("shop_id");
COMMENT ON TABLE "shop" IS '商铺表';
COMMENT ON COLUMN "shop"."shop_id" IS '商铺编号';
COMMENT ON COLUMN "shop"."shop_name" IS '商铺名称';
COMMENT ON COLUMN "shop"."shop_intro" IS '商铺简介';
COMMENT ON COLUMN "shop"."shop_rating" IS '商铺评分';
COMMENT ON COLUMN "shop"."shop_address" IS '商铺地址';
COMMENT ON COLUMN "shop"."contact" IS '联系人';
COMMENT ON COLUMN "shop"."contact_phone" IS '联系电话';
COMMENT ON COLUMN "shop"."email" IS '邮箱';
COMMENT ON COLUMN "shop"."contact_address" IS '联系地址';
COMMENT ON COLUMN "shop"."is_del" IS '是否删除';
COMMENT ON COLUMN "shop"."create_time" IS '创建时间';
COMMENT ON COLUMN "shop"."update_time" IS '更新时间';

-- Dropping table
DROP TABLE IF EXISTS "tanpuhui"."user_info";

-- Creating table
CREATE TABLE "user_info" (
                        "user_info_id" int4 NOT NULL DEFAULT nextval((pg_get_serial_sequence('user_info'::text, 'user_info_id'::text))::regclass),
                        "avatar_address" varchar(255) COLLATE "pg_catalog"."default",
                        "nick_name" varchar(255) COLLATE "pg_catalog"."default",
                        "phone" int8,
                        "real_name" varchar(255) COLLATE "pg_catalog"."default",
                        "wechat" varchar(255) COLLATE "pg_catalog"."default",
                        "title_code" int4,
                        "level_code" int4,
                        "account" varchar(255) COLLATE "pg_catalog"."default",
                        "password" varchar(255) COLLATE "pg_catalog"."default",
                        "person_resume" varchar(255) COLLATE "pg_catalog"."default",
                        "organization" varchar(255) COLLATE "pg_catalog"."default",
                        "is_del" int4,
                        "create_time" timestamp(6),
                        "update_time" timestamp(6),
                        "ext1" varchar(255) COLLATE "pg_catalog"."default",
                        "ext2" varchar(255) COLLATE "pg_catalog"."default",
                        "ext3" varchar(255) COLLATE "pg_catalog"."default",
                        "ext4" varchar(255) COLLATE "pg_catalog"."default",
                        "ext5" varchar(255) COLLATE "pg_catalog"."default"
)
;
ALTER TABLE "user_info" OWNER TO "postgres";
ALTER TABLE "user_info" ADD CONSTRAINT "user_pkey" PRIMARY KEY ("user_id");
ALTER TABLE "user_info" ADD CONSTRAINT "unique_user_id" UNIQUE ("user_id");
COMMENT ON TABLE "user_info" IS '用户表';
COMMENT ON COLUMN "user_info"."user_info_id" IS '用户编号';
COMMENT ON COLUMN "user_info"."avatar_address" IS '头像地址';
COMMENT ON COLUMN "user_info"."nick_name" IS '昵称';
COMMENT ON COLUMN "user_info"."phone" IS '手机号';
COMMENT ON COLUMN "user_info"."real_name" IS '真实姓名';
COMMENT ON COLUMN "user_info"."wechat" IS '微信号';
COMMENT ON COLUMN "user_info"."title_code" IS '称号编号';
COMMENT ON COLUMN "user_info"."level_code" IS '等级编号';
COMMENT ON COLUMN "user_info"."account" IS '账号';
COMMENT ON COLUMN "user_info"."password" IS '密码';
COMMENT ON COLUMN "user_info"."person_resume" IS '个人简介';
COMMENT ON COLUMN "user_info"."organization" IS '组织';
COMMENT ON COLUMN "user_info"."is_del" IS '是否删除';
COMMENT ON COLUMN "user_info"."create_time" IS '创建时间';
COMMENT ON COLUMN "user_info"."update_time" IS '更新时间';

BEGIN;
LOCK TABLE "tanpuhui"."activity" IN SHARE MODE;
DELETE FROM "tanpuhui"."activity";
INSERT INTO "tanpuhui"."activity" ("activity_id","activity_name","img_path","video_path","activity_intro","activity_address","apply_start_time","apply_end_time","activity_start_time","activity_end_time","member_max","member_min","publisher","apply_members","activity_co2","status","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, '乌鲁木齐马拉松', '乌鲁木齐马拉松活动_图片地址', '乌鲁木齐马拉松活动_视频地址', '乌鲁木齐马拉松活动_介绍', '乌鲁木齐马拉松活动_地点', '2024-08-12 14:00:00', '2024-08-20 14:00:00', '2024-08-22 10:00:00', '2024-08-22 20:00:00', 100, 20, '新疆大学', 61, 12600, 0, '2024-01-02 08:00:00', '2025-01-02 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, '乌鲁木齐清扫社区', '乌鲁木齐清扫社区活动_图片地址', '乌鲁木齐清扫社区活动_视频地址', '乌鲁木齐清扫社区活动_介绍', '乌鲁木齐清扫社区活动_地点', '2024-09-12 14:00:00', '2024-09-20 14:00:00', '2024-09-22 10:00:00', '2024-09-22 14:00:00', 30, 10, '乌鲁木齐镇政府', 11, 6300, 0, '2024-01-03 08:00:00', '2025-01-03 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."activity_logs" IN SHARE MODE;
DELETE FROM "tanpuhui"."activity_logs";
INSERT INTO "tanpuhui"."activity_logs" ("participate_id","activity_id","user_id","apply_time","participate_time","reduce_co2","earn_points","is_del","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, 1, 1, '2024-08-12 14:00:00', '2024-08-22 10:00:00', 12600, 2520, 0, '2024-08-12 14:00:00', '2024-08-12 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, 2, 2, '2024-09-12 14:00:00', '2024-09-22 10:00:00', 6300, 1260, 0, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."address" IN SHARE MODE;
DELETE FROM "tanpuhui"."address";
INSERT INTO "tanpuhui"."address" ("address_id","consignee_name","consignee_phone","province","city","area","detail_address","is_default","is_del","user_id","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, '张三', 12345678901, '新疆', '乌鲁木齐', '沙依巴克区', '西北路499号', 0, 0, 1, '2024-01-01 08:00:00', '2025-01-01 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, '张三', 12345678901, '新疆', '喀什', '泽普县', '成华大道', 0, 0, 1, '2024-02-01 08:00:00', '2025-02-01 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(3, '赵四', 18203848202, '上海', '徐汇区', '漕宝路', '二仙桥', 0, 0, 1, '2024-01-01 08:00:00', '2025-01-01 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."behavior" IN SHARE MODE;
DELETE FROM "tanpuhui"."behavior";
INSERT INTO "tanpuhui"."behavior" ("behavior_code","behavior_name","type_unit_code","type_unit_name","co2_coefficine","is_del","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, '步行', 1, '步', 0.15, 0, '2024-01-01 08:00:00', '2025-01-01 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(4, '爬楼梯', 2, '层', 218, 0, '2024-02-01 08:00:00', '2025-02-01 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."behavior_recode" IN SHARE MODE;
DELETE FROM "tanpuhui"."behavior_recode";
INSERT INTO "tanpuhui"."behavior_recode" ("behavior_id","behavior_type","behavior_code","reduce_co2","earn_points","user_id","record_date","is_del","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, '1', 1, 1500, 300, 1, '2024-01-02 08:00:00', 0, '2024-01-01 08:00:00', '2025-01-01 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, '2', 4, 436, 87, 2, '2024-01-02 08:00:00', 0, '2024-01-01 08:00:00', '2025-01-01 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."cart" IN SHARE MODE;
DELETE FROM "tanpuhui"."cart";
INSERT INTO "tanpuhui"."cart" ("cart_id","user_id","goods_id","goods_counts","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, 1, 1, 1, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, 1, 2, 1, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."goods" IN SHARE MODE;
DELETE FROM "tanpuhui"."goods";
INSERT INTO "tanpuhui"."goods" ("goods_id","goods_name","goods_intro","goods_image","goods_price","goods_discount","use_points","shop_id","sale_mode","relate_goods_id","goods_type_id","stander","state","evaluate_id","is_del","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, '优惠卷', '优惠卷_介绍', '优惠卷_图片地址', 90, 0.9, 9000, 1, '售卖品', NULL, 1, '美团/饿了么', 0, 1, 0, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, '洗衣液', '洗衣液_介绍', '洗衣液_图片地址', 23, 0.9, 2300, 2, '售卖品', NULL, 2, '250ml/500ml', 0, 2, 0, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(3, '贺卡', '贺卡_介绍', '贺卡_图片地址', NULL, NULL, NULL, 1, '赠送品', 1, 3, NULL, 0, NULL, 0, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."goods_evaluate" IN SHARE MODE;
DELETE FROM "tanpuhui"."goods_evaluate";
INSERT INTO "tanpuhui"."goods_evaluate" ("evaluate_id","order_id","goods_id","evaluate_type","evaluate_content","evaluate_image","evaluate_video","evaluate_time","is_del","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, 1, 1, '好评', '优惠卷商品评价_内容', '优惠卷商品评价_图片地址', '优惠卷商品评价_视频地址', '2024-09-12 14:00:00', 0, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, 2, 2, '中评', '洗衣液商品评价_内容', '洗衣液商品评价_图片地址', '洗衣液商品评价_视频地址', '2024-09-12 14:00:00', 0, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."order" IN SHARE MODE;
DELETE FROM "tanpuhui"."order";
INSERT INTO "tanpuhui"."order" ("order_id","pay_state","order_price","order_deduct_point","order_deduct_amount","address_id","pay_way","pay_type","user_id","is_del","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, 0, 108, 500, 5, 1, '微信', '线上付款', 1, 0, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."order_item" IN SHARE MODE;
DELETE FROM "tanpuhui"."order_item";
INSERT INTO "tanpuhui"."order_item" ("order_item_id","order_id","goods_id","goods_name","goods_count","evaluate_state","goods_price","transaction_price","deduct_points","deduct_amount","fee_shipping","trans_fee","shipping_methods","arrival_time","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, 1, 1, '优惠卷', 1, 0, 100, 85, 500, 5, 1, 0, NULL, '2024-09-14 14:00:00', '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, 1, 2, '洗衣液', 1, 0, 25.5, 23, 0, 0, 1, 0, NULL, '2024-09-14 14:00:00', '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."shop" IN SHARE MODE;
DELETE FROM "tanpuhui"."shop";
INSERT INTO "tanpuhui"."shop" ("shop_id","shop_name","shop_intro","shop_rating","shop_address","contact","contact_phone","email","contact_address","is_del","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, '每日优惠', '每日优惠商店_介绍', '9.2', '每日优惠商店_地址', '张先生', 19338472837, '2948374893@qq.com', '新疆维吾尔族自治区喀什泽普县', 0, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, '日用品优选', '日用品优选商店_介绍', '8.9', '日用品优选商店_地址', '杰先生', 19938749837, '2948294893@qq.com', '重庆市梁平区回龙镇', 0, '2024-09-12 14:00:00', '2024-09-22 14:01:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;

BEGIN;
LOCK TABLE "tanpuhui"."user_info" IN SHARE MODE;
DELETE FROM "tanpuhui"."user_info";
INSERT INTO "tanpuhui"."user_info" ("user_id","avatar_address","nick_name","phone","real_name","wechat","title_code","level_code","account","password","person_resume","organization","is_del","create_time","update_time","ext1","ext2","ext3","ext4","ext5") VALUES (1, '图片链接_zhangSanFeng', '张三丰', 12345678901, '张三', '微信_zhangSanFeng', 1, 1, '账号_zhangSanFeng', '密码_zhangSanFeng', '个人简介_zhangSanFeng', '所属组织_zhangSanFeng', 0, '2024-01-01 08:00:00', '2025-01-01 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5'),(2, '图片链接_zhaoSiPu', '赵四普', 18203848202, '赵四', '微信_zhaoSiPu', 1, 1, '账号_zhaoSiPu', '密码_zhaoSiPu', '个人简介_zhaoSiPu', '所属组织_zhaoSiPu', 0, '2024-01-02 08:00:00', '2025-01-02 08:00:00', 'data1', 'data2', 'data3', 'data4', 'data5')
;
COMMIT;
